#include<bits/stdc++.h>
using namespace std;

struct pat{
	string name;
	double temperature;
	bool ifcough;
}a[205];

int main()
{
	int n;
	cin>>n;
	
	for (int i=0;i<n;i++)
	{
		cin>>a[i].name;
		cin>>a[i].temperature;
		cin>>a[i].ifcough;
	}
	
	int js=0;
	for (int i=0;i<n;i++)
	{
		if (a[i].temperature >= 37.5 && a[i].ifcough) 
			cout<<a[i].name<<endl,js++;
	}
	cout<<js<<endl;
	
	return 0;
}